// 初始化状态
const initState = [{id:'001', name: 'Tom', age: 12}]

export default function personReducer(preState = initState, action) {
  const {type, data} = action
  switch (type) {
    case 'addPerson':
      return [data, ...preState]
    default:
      return preState
  }
}